package com.xudow.app.newui.adapter;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.util.Log;

import com.activeshare.edu.ucenter.models.course.CourseSetUpItem;
import com.xudow.app.newui.fragment.SupervisionFragemtn;

import java.security.PrivateKey;
import java.util.List;

/**
 * 作者：LownChen on 2016/6/27 14:33
 */
public class MyVPAdapter extends FragmentPagerAdapter {
    private final int PAGER_COUNT=4;
    private SupervisionFragemtn sf1,sf2,sf3,sf4;
    public MyVPAdapter(FragmentManager fm) {
        super(fm);

        sf1=new SupervisionFragemtn();

        sf2=new SupervisionFragemtn();

        sf3=new SupervisionFragemtn();

        sf4=new SupervisionFragemtn();
        sf1.setType(0);
        sf2.setType(1);
        sf3.setType(2);
        sf4.setType(3);
    }

    public void setData(List<CourseSetUpItem> setups){
        sf1.updataInfo(setups);
        sf2.updataInfo(setups);
        sf3.updataInfo(setups);
        sf4.updataInfo(setups);
    }
    @Override
    public Fragment getItem(int position) {
        SupervisionFragemtn sf=null;
        switch (position){
            case 0:
                sf=sf1;

                break;
            case 1:
                sf=sf2;

                break;
            case 2:
                sf=sf3;

                break;
            case 3:
                sf=sf4;

                break;
        }
        return sf;
    }

    @Override
    public int getCount() {
        return PAGER_COUNT;
    }
}
